perm filename STRING.RPG[UP,DOC] blob sn#613334 filedate 1981-09-21 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00003 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	   STRING 	-*-MODE:LISPPACKAGE:SI-*-		  -*-LISP-*-
C00008 00003
C00009 ENDMK
C⊗;
;;;   STRING 	-*-MODE:LISP;PACKAGE:SI-*-		  -*-LISP-*-
;;;   **************************************************************
;;;   *** NIL ***** Functions for CHARACTERs and STRINGs ***********
;;;   **************************************************************
;;;   ** (C) COPYRIGHT 1980 MASSACHUSETTS INSTITUTE OF TECHNOLOGY **
;;;   ****** THIS IS A READ-ONLY FILE! (ALL WRITES RESERVED) *******
;;;   **************************************************************

;;; Provides support for NIL string operations under maclisp, with
;;;   some functions added for compatibility with LISPM and maclisp.
;;; To read this file in on LISPM, do (PACKAGE-DECLARE * SYSTEM 100)

;;; CHARACTER support:
;;;     CHARACTERP,
;;; m	*:CHARACTER-TO-FIXNUM, *:FIXNUM-TO-CHARACTER
;;; 	TO-CHARACTER, TO-CHARACTER-N, DIGITP, DIGITP-N
;;; +	CHARACTER, CHAR-EQUAL, CHAR-LESSP,
;;; &	|+internal-tilde-macro/||  (can be set onto ~ as readmacro)
;;; STRING support:
;;; 	STRINGP
;;; m   CHAR, RPLACHAR
;;; m   STRING-LENGTH, SET-STRING-LENGTH, STRING-SEARCHQ, STRING-BSEARCHQ
;;; 	TO-STRING, MAKE-STRING, STRING-SUBSEQ, STRING-MISMATCHQ
;;; *	CHAR-N, RPLACHAR-N, STRING-FILL, STRING-FILL-N, STRING-REPLACE
;;; * 	STRING-POSQ, STRING-BPOSQ, STRING-POSQ-N, STRING-BPOSQ-N
;;; * 	STRING-SKIPQ, STRING-BSKIPQ, STRING-SKIPQ-N, STRING-BSKIPQ-N
;;; +m 	STRING-EQUAL, STRING-LESSP, STRING-SEARCH, STRING-REVERSE-SEARCH
;;; +m 	STRING-DOWNCASE, STRING-UPCASE
;;; +	GET-PNAME, SUBSTRING, STRING-APPEND, STRING-REVERSE, STRING-NREVERSE
;;; +   STRING-TRIM, STRING-LEFT-TRIM, STRING-RIGHT-TRIM
;;; +*  CHAR-DOWNCASE, CHAR-UPCASE,
;;; +*  STRING-SEARCH-CHAR, STRING-SEARCH-NOT-CHAR, 
;;; +*  STRING-SEARCH-SET, STRING-SEARCH-NOT-SET
;;; +*  STRING-REVERSE-SEARCH-CHAR, STRING-REVERSE-SEARCH-NOT-CHAR, 
;;; +*  STRING-REVERSE-SEARCH-SET, STRING-REVERSE-SEARCH-NOT-SET
;;; *   STRING-EXPLODEN, STRING-PNGET, STRING-PNPUT
;;; &	STR/:PURCOPY, STR/:PRINTER, |+internal-doublequote-macro/||  
;;; &* 	STR/:CLEAR-WORDS, STR/:GRAB-PURSEG

;;;   (a "m" is for lines whose routines are implemnted as bot macros and
;;; 	subrs - macro definition is active only in the compiler)

;;;   (a + is for lines whose routines are directly LISPM compatible - 
;;; 	many other such routines can be written using the NIL primitives)

;;;   (an * is for lines whose routines have been written in MIDAS - 
;;; 	primarily for speed - and are in the file STRAUX >)

;;;   (a & is for lines whose routines are PDP10-specific, and are 
;;; 	 primarily for internal support)

;;;   (the functions named "...-N" use ascii numerical values for their 
;;; 	arguments which are interpreted as "CHARACTER"s, instead of the
;;; 	new datatype "CHARACTER"  - thus while STRING-POSQ scans for a 
;;; 	particular character in a string, STRING-POSQ-N wants its character
;;; 	as a fixnum.)

;				  ---------
;A  "STRING" is a 4-hunk, with    | 1 | 0 | 
;  indices as indicated in the	  ---------
;  diagram.			  | 3 | 2 |
;				  ---------
;  (cxr 0 s) 	;ptr to class object for STRINGs
;  (cxr 1 s) 	;"**SELF-EVAL**" 
;  (cxr 2 s) 	;word-index in STR:ARRAY of first word
;  (cxr 3 s) 	;length of string, in characters


β